package com.example.thread;

/**
 * @author hl
 */
public class ThreadClass extends Thread {
    ThreadClass(String name) {
        setName(name);
    }

    @Override
    public void run() {
        System.out.println("演员：" + getName());
        int count = 0;
        while (count < 100) {
            System.out.println(getName() + "演出的次数：" + (++count));
        }
        System.out.println(getName() + "演出结束!");
    }

    //    public static void main(String[] args) {
//        int num = 5;
//        Thread thread = new Thread(new ThreadInterface(num),"HJ");
//        Thread thread1 = new Thread(new ThreadInterface(num),"HMM");
//        thread.start();
//        thread1.start();
//    }
    public static void main(String[] args) {
        EnergySystem system = new EnergySystem(2,1000);
        for (int i = 0;i<2;i++){
            ThreadInterface threadInterface = new ThreadInterface(system,i,20);
            Thread t = new Thread(threadInterface);
            t.start();
        }
    }
}
